const MAIN = resolve => require(['components/main'], resolve); //主容器
const LOGIN = resolve => require(['components/login'], resolve); // 登陆
const INDEX = resolve => require(['components/index'], resolve); // 首页

const SETTLE = resolve => require(['components/settle'], resolve); //入驻
const SETTLE_PROGRESS = resolve => require(['components/settle/settleProgress'], resolve); //入驻进度
const SETTLE_FAil = resolve => require(['components/settle/settleFail'], resolve); //入驻失败

const BUSINESS_INFO = resolve => require(['components/user/BusinessInfo'], resolve); //经营信息
const ACCOUNT = resolve => require(['components/user/account'], resolve); //账号管理

const FORGET_PASSWORD = resolve => require(['components/ForgetPassword'], resolve); //忘记密码

const ADD_STATEMENT = resolve => require(['components/statement/AddStatement'], resolve); //新增结算单
const UPLOAD_STATEMENT = resolve => require(['components/statement/UploadStatement'], resolve); //上传结算单
const QUERY_STATEMENT = resolve => require(['components/statement/QueryStatement'], resolve); //查询结算单
const QUERY_STATEMENT_LIST = resolve => require(['components/statement/QueryStatement/list'], resolve); //查询结算单的列表
const QUERY_STATEMENT_CHECK = resolve => require(['components/statement/QueryStatement/check'], resolve); //查询结算单的查看详情页
const QUERY_STATEMENT_UPLOAD = resolve => require(['components/statement/QueryStatement/upload'], resolve); //查询结算单的查看详情页


const COMPLAIN_MESSAGE = resolve => require(['components/message/complain'], resolve); //投诉信息管理
const EVALUATE_MESSAGE = resolve => require(['components/message/evaluate'], resolve); //评价信息管理
const INFORM_MESSAGE = resolve => require(['components/message/inform'], resolve); //通知信息管理

const EVALUATE_STATISTICS = resolve => require(['components/statistics/evaluate'], resolve); //评价统计
const MAINTAIN_STATISTICS = resolve => require(['components/statistics/maintain'], resolve); //维修统计

const STORE_INFORMATION = resolve => require(['components/store/information'], resolve); //门店基本信息
const ADD_STORE = resolve => require(['components/store/add'], resolve); //新增门店信息

const POLICY = resolve => require(['components/policy'], resolve); //资讯政策
const POLICY_LIST = resolve => require(['components/policy/list'], resolve); //资讯政策列表
const POLICY_DETAIL = resolve => require(['components/policy/detail'], resolve); //资讯政策详情

const routes = [{
    path: '/',
    redirect: 'login'
  },
  /* ==================== 登录 ===================== */
  {
    path: '/login',
    name: 'login',
    component: LOGIN
  },
  /* ==================== 入驻 ===================== */
  {
    path: '/settle',
    name: 'settle',
    component: SETTLE
  },
  /* =================== 入驻进度 =================== */
  {
    path: '/settleProgress',
    name: 'settleProgress',
    component: SETTLE_PROGRESS,
    meta: {
      requiresAuth: true
    } 
  },
  /* =================== 入驻失败 =================== */
  {
    path: '/settleFail',
    name: 'settleFail',
    component: SETTLE_FAil,
    meta: {
      requiresAuth: true
    }
  },
  /* =================== 新增门店 =================== */
  {
    path: '/addStore',
    name: 'addStore',
    component: ADD_STORE,
    meta: {
      requiresAuth: true
    }
  },
  /* ================== 忘记密码 =================== */
  {
    path: '/forgetPassword',
    name: 'forgetPassword',
    component: FORGET_PASSWORD
  },
  /* ================== 经营信息 =================== */
  {
    path: '/businessInfo',
    name: 'businessInfo',
    component: BUSINESS_INFO
  },
  /* ================== 账号管理 =================== */
  {
    path: '/account',
    name: 'account',
    component: ACCOUNT
  },
  /* ================= main主容器 =================== */
  {
    path: '/main',
    name: 'main',
    component: MAIN,
    children: [
      /* ==================== 首页 ===================== */
      {
        path: '/index',
        name: 'index',
        component: INDEX,
        meta: {
          requiresAuth: true,
          selectMenu: '0-0'
        }
      },

      /* ================= 添加结算单 =================== */
      {
        path: '/addStatement',
        name: 'addStatement',
        component: ADD_STATEMENT,
        meta: {
          requiresAuth: true,
          selectMenu: '1-0'
        }
      },

      /* ================= 上传结算单 =================== */
      {
        path: '/uploadStatement',
        name: 'uploadStatement',
        component: UPLOAD_STATEMENT,
        meta: {
          requiresAuth: true,
          selectMenu: '1-1'
        }
      },

      /* ================= 查询结算单 =================== */
      {
        path: '/queryStatement',
        name: 'queryStatement',
        component: QUERY_STATEMENT,
        redirect: '/queryStatement/list',
        children: [ 
          {
            path: 'list',
            name: 'queryStatementList',
            component: QUERY_STATEMENT_LIST,
            meta: {
                requiresAuth: true,
                selectMenu: '2-0'
            }
          },
          {
            path: 'check',
            name: 'queryStatementCheck',
            component: QUERY_STATEMENT_CHECK,
            meta: {
                requiresAuth: true,
                selectMenu: '2-0'
            }
          },
          {
            path: 'upload',
            name: 'queryStatementUpload',
            component: QUERY_STATEMENT_UPLOAD,
            meta: {
                requiresAuth: true,
                selectMenu: '2-0'
            }
          },
        ]
      },

      /* ================= 投诉信息管理 =================== */
      {
        path: '/complainMessage',
        name: 'complainMessage',
        component: COMPLAIN_MESSAGE,
        meta: {
          requiresAuth: true,
          selectMenu: '3-0'
        }
      },

      /* ================= 评价信息管理 =================== */
      {
        path: '/evaluateMessage',
        name: 'evaluateMessage',
        component: EVALUATE_MESSAGE,
        meta: {
          requiresAuth: true,
          selectMenu: '4-0'
        }
      },

      /* ================= 通知信息管理 =================== */
      {
        path: '/informMessage',
        name: 'informMessage',
        component: INFORM_MESSAGE,
        meta: {
          requiresAuth: true
        }
      },

      /* ================= 维修统计 =================== */
      {
        path: '/maintainStatistics',
        name: 'maintainStatistics',
        component: MAINTAIN_STATISTICS,
        meta: {
          requiresAuth: true,
          selectMenu: '5-0'
        }
      },

      /* ================= 评价统计 =================== */
      {
        path: '/evaluateStatistics',
        name: 'evaluateStatistics',
        component: EVALUATE_STATISTICS,
        meta: {
          requiresAuth: true,
          selectMenu: '5-1'
        }
      },

      /* ================= 门店管理 =================== */
      {
        path: '/storeInformation',
        name: 'storeInformation',
        component: STORE_INFORMATION,
        meta: {
          requiresAuth: true,
          selectMenu: '6-0'
        }
      }
    ]
  },
  ,

  /* ================= 资讯政策 =================== */
  {
    path: '/policy',
    name: 'policy',
    component: POLICY,
    redirect: '/policy/list',
    children: [
      {
        path: 'list',
        name: 'policyList',
        component: POLICY_LIST,
        meta: {
          keepAlive: true,
          requiresAuth: true
        }
      },
      {
        path: 'detail',
        name: 'policyDetail',
        component: POLICY_DETAIL,
        meta: {
          requiresAuth: true
        }
      }
    ]
  },
]

export default routes;
